<template>
  <div
    style="    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;height: 100vh;"
  >
    <div class="printTest">
      <pdf ref="pdf" :src="pdfUrl"></pdf>
    </div>
  </div>
</template>

<script>
import pdf from "vue-pdf";

export default {
  name: "PrintPDF",
  components: {
    pdf
  },
  data() {
    return {
      pdfUrl
    };
  },

  created() {
    const { pdfUrl } = this.$route.query;
    document.title = "快递单打印";
    this.pdfUrl = pdfUrl;
  },
  mounted() {
    pdf
      .createLoadingTask(this.pdfUrl)
      .then(() => {
        this.$nextTick(() => {
          // print();

this.$refs.pdf.print();
        });
      });
  }
};
</script>

<style lang="scss" scoped>
</style>
